<? session_start();

include("SVsystem/config/dbconfig.php"); ////////setup
include("SVsystem/class/clases.php");
include("SVsystem/config/dominio.php");

$tool = new formulario('db');

	$cat = new tools();
	$cat->dbc = $tool->dbc;

	$dataindex = $tool->simple_db("select index_youtube,index_image,index_titulo,index_texto,index_desc,index_meta,index_footer from preferencias");
	
	 ///funcion para articulos en categoria del index
	 function traer_item_categoria($categoria,$tabla,$numero,$orden){

				if($tabla!="prod"){ $n="titulo as nombre"; $link ="SV-detalle-articulo.php";  $imagen = "imagen";   $tabla = 'articulo'; }else{  $n="nombre"; $link ="SV-detalle-producto.php"; $imagen = "(select ruta from imagen_producto where prod_id = a.id limit 1) as imagen"; $tabla = 'producto'; } 
				
				$carpeta = "contenido";
			
			if($numero>0) $num = "limit $numero"; else $num = "";
			
			////para obtener el nivel y el id
		   $cati = explode('_',$categoria);
			
			$query = "select id,$n,resumen,date_format(fecha_mod,'%d/%m%/%Y') as fecha,
			$imagen
			from $tabla a
			where cat_id = '$cati[1]' and cat_nivel = '$cati[0]' order by orden";
			
			return $query;
		}
                              

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
	<title><?php echo utf8_encode($dataindex['index_titulo']); ?></title>
    <meta name="description" lang="es" content="<?php echo $dataindex['index_desc']; ?>" />
	<meta name="keywords" content="<?php echo $dataindex['index_meta']; ?>" />
	<link rel="stylesheet" href="estilo.css" type="text/css" media="screen" title="no title" charset="utf-8">
	<script src="/SVsystem/js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="/SVscripts/menu.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="SVsystem/js/utils.js"></script>
<script type="text/javascript" src="SVsystem/js/banner-mouseover.js"></script>
    <script type="text/javascript" src="SVsystem/js/ajax.js"></script>

<script language="JavaScript">

    function function1(){

        document.all.iemarquee.direction = "up";

    }

    function function2(){

        document.all.iemarquee.direction = "left";

    }

    function function3(){

        document.all.iemarquee.direction = "right";

    }

    function function4(){

        document.all.iemarquee.direction = "down";

    }

</script>




</head>
<body>
<?php include('SVG-header.php'); ?>
<div id="wrapper">
	<div id="contenido">
		<div id="izquierda">
			<?php include('SVG-menu-categorias-bk.php'); ?>
		</div>
		<div id="centro">
<h1><?php echo $dataindex['index_titulo']; ?></h1>
			<div id="index">
				  

<?php if(!empty($dataindex['index_image'])){ ?>
							<img src="<?php echo $DOMINIOSV."/contenido/orig/".$dataindex['index_image']; ?>"width="178" height="146"  alt="<?php echo $dataindex['index_titulo']; ?>" />
                     <?php } ?> 
                             
               <?php echo $dataindex['index_texto']; ?>
            </div>
            
  
<!-- PEC -->


<?php include('SVG-pec.php'); ?>



<!-- /  PEC -->

<div id="separador"></div>




            <?php
					////articulos en categorias
				   $tool->query("select * from artxcat order by orden ");

				   $ii=0;
				   while ($row = mysql_fetch_assoc($tool->result)) { 

					 ?> <? 
							include ("SVG-aec.php");
					  ?><?
						
				   }	
				   ///////////////////////

				   ?>
            









<!-- CARRUSEL -->








<div id="carusel">
			<div  class="titulo-car">
				<h3>Productos Destacados</h3>
				<a class="right browse next" onmouseover="function3();"></a><a class="left prev browse" onmouseover="function2();"></a>
			</div>
				<div id="scroller-cont" class="name">
                  





<script language="JavaScript1.2">



/*

Cross browser Marquee script-  Dynamic Drive (www.dynamicdrive.com)

For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com

Credit MUST stay intact

*/



//Specify the marquee's width (in pixels)

var marqueewidth="525px"

//Specify the marquee's height

var marqueeheight="174px"

//Specify the marquee's marquee speed (larger is faster 1-10)

var marqueespeed=1

//configure background color:

var marqueebgcolor=""

//Pause marquee onMousever (0=no. 1=yes)?

var pauseit=1



//Specify the marquee's content (don't delete <nobr> tag)

//Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):



var marqueecontent='<nobr><iframe name="carrusel"  width="1200" height="170" scrolling="no" vspace="0" hspace="0" src="http://www.lefama.com/carrusel.php" frameborder="0" marginwidth="0" marginheight="0"></iframe></nobr>'





////NO NEED TO EDIT BELOW THIS LINE////////////

marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS

var copyspeed=marqueespeed

var pausespeed=(pauseit==0)? copyspeed: 0

var iedom=document.all||document.getElementById

if (iedom)

document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>')

var actualwidth=''

var cross_marquee, ns_marquee



function populate(){

if (iedom){

cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee

cross_marquee.style.left=parseInt(marqueewidth)+8+"px"

cross_marquee.innerHTML=marqueecontent

actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth

}

else if (document.layers){

ns_marquee=document.ns_marquee.document.ns_marquee2

ns_marquee.left=parseInt(marqueewidth)+8

ns_marquee.document.write(marqueecontent)

ns_marquee.document.close()

actualwidth=ns_marquee.document.width

}

lefttime=setInterval("scrollmarquee()",20)

}

window.onload=populate



function scrollmarquee(){

if (iedom){

if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))

cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"

else

cross_marquee.style.left=parseInt(marqueewidth)+8+"px"



}

else if (document.layers){

if (ns_marquee.left>(actualwidth*(-1)+8))

ns_marquee.left-=copyspeed

else

ns_marquee.left=parseInt(marqueewidth)+8

}

}



if (iedom||document.layers){

with (document){

document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')

if (iedom){

write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')

write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')

write('<div id="iemarquee" style="position:absolute;left:0px;top:0px"></div>')

write('</div></div>')

}

else if (document.layers){

write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')

write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')

write('</ilayer>')

}

document.write('</td></table>')

}

}

</script>

























































	    </div>
				<a href="SV-productos-destacados.php" class="verdest">Ver Todos los productos Destacados</a>		</div>
<!-- ///////// CARRUSEL -->




































		</div>
		<div id="derecha">
          
            <?php if(empty($_SESSION['CLIENTE_ID'])){
            
                    //////////en el caso de que se decida hacer log in
                    include("login_flow.php");
                    ?>
            <!-- INCLUIR user-login.php o usuario-logead.php -->
                 <?php include('SVG-login.php'); ?>	
               <?php  }else{ ?>
                  <?php include('SVG-barra-usuario.php'); ?>
             <?php }?>
            
				<div  class="banners">
					<?php include('SVG-banners.php'); ?>
				</div>		
		</div>
	<div id="separador"></div>
<!--fin del div de contenido -->
</div>


	<div id="fincontenido"></div>
<?php include('SVG-footer.php'); ?>
</div>
</body>
</html>